//
//  CarTypeListViewController.m
//  OCUI
//
//  Created by login on 15-8-5.
//
//

#import "CarTypeListViewController.h"
#import "HttpClient.h"
@interface CarTypeListViewController ()<UITableViewDataSource,UITableViewDelegate,HttpClientDelegate>
{
    UITableView *carListTableView;
}
@end

@implementation CarTypeListViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    self.title = @"车型列表";
    self.view.backgroundColor = [UIColor whiteColor];
    [self initData];
}

- (void)initData
{
    HttpClient *http = [[HttpClient alloc]init];
    http.delegate = self;
    
    NSString *hostString = @"http://192.168.3.62:8901/specialcar/routes1?clienttype=2";
//    NSMutableDictionary *dice = [NSMutableDictionary dictionary];
//    [dice setObject:@"2" forKey:@"clienttype"];
//    
//    [http getRequestAsyWithProgress:self.view and:hostString and:dice requestType:GET];
    NSURL *url = [NSURL URLWithString:hostString];
    NSURLRequest *request = [[NSURLRequest alloc]initWithURL:url cachePolicy:NSURLRequestUseProtocolCachePolicy timeoutInterval:10];
    [NSURLConnection sendAsynchronousRequest:request queue:[[NSOperationQueue alloc]init] completionHandler:^(NSURLResponse *response, NSData *data, NSError *connectionError) {
        
        if (!connectionError) {
            NSDictionary *dic = [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingMutableContainers error:nil];
            NSLog(@"%@",dic);

        }else{
            NSLog(@"%@",connectionError);
        }
    }];


}

- (void)sendRequestDataArray:(NSDictionary *)dict
{
    NSLog(@"%@",dict);
}

- (void)initTableView
{
    carListTableView = [[UITableView alloc]initWithFrame:self.view.frame];
    carListTableView.delegate = self;
    carListTableView.dataSource = self;
    [self.view addSubview:carListTableView];
}

//- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
//{
//    return 2;
//}
//
//
//- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
//{
//
//}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
